﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.UserControl" %>
<%@ Import Namespace="Portal.Core.Utils" %>
<%@ Import Namespace="Portal.Data.Entity" %>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        var action = Request["act"];

        dynamic jdata = new DynamicJsonObject();
        switch (action)
        {
            case "find":
                var sortkey = Process.ConvertToSafeMarks(Request["key"]).Replace("-", "").Trim().ToLower();
                if (sortkey.Length > 0)
                {
                    var all = Author.FindBySortName(sortkey).Take(20);
                    jdata.label = all.Select(x => x.FullName).ToArray();
                }
                Response.Write(jdata.ToString());
                Response.End();
                break;
        }
    }
</script>
